package a;


import com.alibaba.fastjson2.JSONObject;

import java.io.FileInputStream;
import java.io.IOException;

/**
 * @author: jzw
 * @Description
 * @date: 2022/9/1 21:14
 */
public class JsonToCount1 {
    public static void main(String[] args) throws IOException {
        // 获取文件的输入流对象
        FileInputStream fileInputStream = new FileInputStream("F:\\workspace\\jsonlocal.json");
        int len;
        byte[] bytes = new byte[1024];
        StringBuilder stringBuffer = new StringBuilder();
        while ((len = fileInputStream.read(bytes)) != -1) {
            // 添加字符串到缓冲区
            stringBuffer.append(new String(bytes, 0, len));
        }
        // 关闭资源
        fileInputStream.close();

        Account account = JSONObject.parseObject(stringBuffer.toString(), Account.class);
        System.out.println(account);

        /*String stringBuffer= "{\"OpType\":\"M\",\"UserID\":\"2711000550838704\",\"PaymentMethod\":\"1\",\"Province\":\"280\",\"City\":\"2800\",\"AreaCode\":\"028\",\"IMSI\":\"460049332503144\",\"MSISDN\":\"1440733253144\",\"ICCID\":\"89860473232070703144\",\"IoVCardType\":\"4\",\"CustomerStatus\":\"停机\",\"StatusUpdateTime\":\"20220818185518\",\"AcceptTime\":\"20201222191128\",\"ActivationTime\":\"20210318204157\",\"FirstCallTime\":\"20210318204157\",\"ChannelType\":\"1\",\"LogginginAddress\":\"四川省成都市温江区\",\"NodeCode\":\"60000000165582\",\"ChannelName\":\"温江集团客户部\",\"StaffID\":\"sczhangjingjing\",\"ServiceType\":\"[\\\"2020版物联卡通用流量池套餐\\\",\\\"2020版物联网卡集团流量池月功能费\\\",\\\"SIM卡费（月结）\\\",\\\"人联网访问控制\\\",\\\"停机保号\\\",\\\"停机保号\\\",\\\"停机保号\\\",\\\"停机保号\\\",\\\"停机保号\\\",\\\"物联卡个人\\\",\\\"物联卡集团通用流量池\\\",\\\"通用数据通信服务（2/3/4G）\\\",\\\"限额管控\\\"]\",\"Voice\":\"0\",\"Message\":\"0\",\"Data\":\"1\",\"VoiceLimType\":\"\\\\N\",\"VoiceDirNum\":\"\\\\N\",\"VoiceDirList\":\"[\\\"\\\\\\\\N\\\"]\",\"MessageLimType\":\"\\\\N\",\"MessageDirNum\":\"\\\\N\",\"MessageDirList\":\"[\\\"\\\\\\\\N\\\"]\",\"DataLimType\":\"4\",\"DataStartDate\":\"\\\\N\",\"DataLimit\":\"\\\\N\",\"DataDirStartDate\":\"20201222\",\"DataDirLimit\":\"100.00\",\"DataDirNum\":\"4\",\"DataDirList\":\"[\\\"182.131.17.28\\\",\\\"*.ectekcloud.cn*\\\",\\\"*.data.hubeiyikong.com*\\\",\\\"*.jc.bjmemc.com.cn*\\\"]\",\"BlackName\":\"1\",\"BindState\":\"1\",\"BindType\":\"2\",\"CompanyName\":\"成都易控智联汽车电子有限公司\",\"CompanyCertType\":\"I\",\"CompanyCertNumber\":\"91510112597274273M\",\"CompanyCertAddress\":\"成都经开区（龙泉驿）总部经济港888号46栋-4\",\"CompanyPosterAddress\":\"成都经开区（龙泉驿）总部经济港888号46栋-4\",\"OperatorName\":\"杨杰\",\"OperatorCertType\":\"A\",\"OperatorCertNumber\":\"510123198602102837\",\"OperatorCertAddress\":\"成都市温江区柳城柳浪湾北一街１１２号１栋４楼３号\",\"OperatorPosterAddress\":\"成都市温江区柳城柳浪湾北一街１１２号１栋４楼３号\",\"EndOperatorTelephone\":\"\",\"CorporationName\":\"杨杰\",\"CorporationCertType\":\"A\",\"CorporationCertNumber\":\"510123198602102837\",\"CorporationCertAddress\":\"成都市温江区柳城柳浪湾北一街１１２号１栋４楼３号\",\"CorporationPosterAddress\":\"成都市温江区柳城柳浪湾北一街１１２号１栋４楼３号\",\"Corporat\":\"13881978261\"}\n";
        String s = stringBuffer.trim();
        String substring = s.substring(1, s.length() - 1);
        System.out.println(substring);
        String replace = s.replace("\\N", "abc");
        JSONObject jsonObject = JSON.parseObject(replace);
        Account account = JSON.toJavaObject(jsonObject, Account.class);
        System.out.println(account);*/
    }
}
